var order = ['red', 'yellow', 'blue', 'green', 'red']
Page({
  data: {
    toView: 'red',
    scrollTop: 100,
    test: 2,
    allRounds: [[1,2,3,4],[2,2,3,3]],
    results: [0,2,-2,0]
  },
  upper: function (e) {
    console.log(e)
  },
  lower: function (e) {
    console.log(e)
  },
  scroll: function (e) {
    console.log(e)
  },
  tap: function (e) {
    for (var i = 0; i < order.length; ++i) {
      if (order[i] === this.data.toView) {
        this.setData({
          toView: order[i + 1]
        })
        break
      }
    }
  },
  createNewRound: function (e) {
    var ars = this.data.allRounds;
    
  },
  makeResult: function(e){
    var a = [0, 0, 0, 0];

    for (var ari = 0; ari < this.data.allRounds.length; ari++) {
      var round = this.data.allRounds[ari];
      for (var i = 0; i < round.length; i++) {
        a[i] += round[i];
      }
    }

    this.setData({
      results: a
    })
  }
})